﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 外观模式
{
    //外观类
   public class Mortgage
    {
        private Bank bank=new Bank();
        private Credit credit=new Credit();
        private Loan loan=new Loan();

       public bool IsEligible(Customer cust, int amount)
       {
           var eligible = true;
           if (!bank.HasSufficientSavings(cust, amount))
            {
                eligible = false;
            }
            else if (!loan.HasNoBadLoans(cust))
            {
                eligible = false;
            }
            else if (!credit.HasGoodCredit(cust))
            {
                eligible = false;
            }
            return eligible;
        }
    }
}
